class UserObserver < ActiveRecord::Observer
  def after_create(user)
    worker = MiddleMan.worker(:user_mailer_worker)
    worker.enq_deliver_signup_notification(:arg => user.id, :job_key => "#{user.id}_signup_notification")
  end

  def after_save(user)  
    if user.recently_activated?
      user.toggle!(:recently_activated)
      worker = MiddleMan.worker(:user_mailer_worker)
      worker.enq_deliver_activation(:arg => user.id, :job_key => "#{user.id}_activation")
    end
  end
end
